1. Field
The present invention relates to an image processing apparatus, an image processing method and a program which search a similar area to a previously registered model from an input image.
2. Related Art
In the FA (Factory Automation) field or the like, conventionally, search processing (hereinafter referred to as “pattern matching) based on a previously registered pattern (hereinafter referred to as a “model”) is used for an input image obtained by capturing an image of a measuring target (hereinafter referred to as a “workpiece”). By the pattern matching, it is possible to detect a defect such as scratch or refuse which appears on the workpiece or to search an area on the workpiece which is similar to the model.
As a technique for the pattern matching, it is known that a portion (which will be hereinafter referred to as an “edge (part)”) having change in a gray level value (brightness) in an input image is extracted and pattern matching is carried out based on a value indicative of a direction of the change in the edge (hereinafter referred to as an “edge code” or “EC (Edge Code)”). For example, see Japanese Laid-Open Patent Publication No. 2002-230549.
Moreover, the Japanese Laid-Open Patent Publication No. 2002-230549 discloses pattern matching to be performed through threshold processing based on a score accumulative value. In the pattern matching, specifically, a score indicative of a matching degree of an edge code between each pixel and a corresponding pixel in model data is calculated on a pixel unit and a value obtained by accumulating them is set to be a similarity degree. The model data is scanned in an input image while a maximum value of the similarity degree is obtained. It is determined whether a matched area with the model is present in the input image or not according to whether the maximum value exceeds a prescribed threshold or not.
By using the edge code, it is possible to accurately search the matched area with the model regardless of an influence in pickup of the input image (for example, reflection of a shadow or illumination unevenness).
In addition, a matching degree of a model and an entire measuring target is conventionally calculated based on a search result of an area matched with the model. Moreover, quality of the measuring target is determined based on the calculated matching degree and a predetermined threshold.
There are needs to permit local shape deformation of the measuring target. However, in order to meet the above needs, decreasing the threshold of the similarity degree (the score accumulative value) to meet the above needs increases risk of erroneous permission of a mismatched shape with the model.